package com.gp.node.operator;

import java.util.List;

import com.gp.node.INode;

// interface for unary operations
public abstract class IOperatorUnary implements IFather {
	
	private static final long serialVersionUID = -238206973723833699L;
	// the node child
	protected INode child = null;
	
	// return the node only child
	public INode getChild() {
		return child;
	}

	// set the node child
	public void setChild(INode child) {
		this.child = child;
	}

	// set the node child
	protected void setByClone(IOperatorUnary op){		 
		 if(op.getChild() != null){
			 setChild(op.getChild().createNew());
		 }		
	}
	
	@Override
	public void fillAll(List<INode> ls) {
		ls.add(this);
		child.fillAll(ls);
	}

	@Override
	public void fillFathers(List<IFather> ls) {
		ls.add(this);
		child.fillFathers(ls);
	}
}
